'use client';

import EditableTable from '@/pao/web/dataEdit/dateEditEditableTable';
import { Subject } from '@/data/prisma';
import { ProColumnType } from '@ant-design/pro-components';

import { addRow, deleteRow, editRow, query } from './service';

const columns: ProColumnType<Subject>[] = [
    {
        title: '编号',
        dataIndex: 'code',
        fixed: 'left',
        sorter: true,
        width: '80px',
    },
    {
        title: '名称',
        dataIndex: 'name',
        sorter: true,
        fixed: 'left',
        width: '150px',
    },
    {
        title: '备注',
        dataIndex: 'comments',
        sorter: true,
        width:'auto',
    },
];

const config = {
    headerTitle: '科目',
    tooltip: '修改科目信息',
}

export default function SubjectControl() {
    return <EditableTable<Subject> columns={columns} rowKey="id" config={config} deleteRow={deleteRow} query={query} editRow={editRow} addRow={addRow}/>
}